<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<a id="submit" class="mui-btn mui-btn-blue mui-btn-link mui-pull-right">保存</a>
			<h1 class="mui-title">登录密码</h1>
		</header>
		<div class="mui-content">
			<form id='login-form' class="mui-input-group mui-margin-top">
				<div class="mui-input-row">
					<label>当前密码</label>
					<input id='Password' type="password" class="mui-input-clear mui-input" placeholder="请输入当前密码">
				</div>
			</form>
			<form id='login-form' class="mui-input-group mui-margin-top">
				<div class="mui-input-row">
					<label>新密码</label>
					<input id='NewPassword' type="password" class="mui-input-clear mui-input" placeholder="请输入新密码">
				</div>
				<div class="mui-input-row">
					<label>确定密码</label>
					<input id='ConfirmNewPassword' type="password" class="mui-input-clear mui-input" placeholder="请再次输入新密码">
				</div>
			</form>
		</div>

		<script src="js/mui.min.js"></script>
		<script src="js/app.js"></script>
		<script type="text/javascript">
			mui.init();

			document.getElementById("submit").addEventListener('tap', function() {
				var Password = document.getElementById("Password").value;
				var NewPassword = document.getElementById("NewPassword").value;
				var ConfirmNewPassword = document.getElementById("ConfirmNewPassword").value;

				if(Password == "" || NewPassword == "" || ConfirmNewPassword == "") {
					mui.toast("请输入");
					return;
				}
				
				plus.nativeUI.showWaiting();

				app.post("ChangeLoginPassword", {
					MemberAccount: app.account(),
					Password: Password,
					NewPassword: NewPassword,
					ConfirmNewPassword: ConfirmNewPassword
				}, function(data) {
					if(data.isSuccess) {
						mui.toast("密码修改成功");
						mui.back();
					} else {
						mui.toast(data.message);
					}
				});
			});
		</script>
	</body>

</html>